package com.jxaummd.aquaculture.ui.fragment.first.fun;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.ToastUtils;
import com.jxaummd.aquaculture.R;
import com.jxaummd.aquaculture.adapter.RecordAdapter;
import com.jxaummd.aquaculture.base.BaseBackFragment;
import com.jxaummd.aquaculture.entity.Device;
import com.jxaummd.aquaculture.entity.Record;
import com.jxaummd.aquaculture.listener.OnItemClickListener;
import com.jxaummd.aquaculture.util.net.RestClient;
import com.jxaummd.aquaculture.util.net.callback.ISuccess;

public class RecordFragment extends BaseBackFragment {
    private Device device;
    private RecyclerView mRecy;
    private RecordAdapter mAdapter;

    public static RecordFragment newInstance(Device device) {
        Bundle args = new Bundle();
        RecordFragment fragment = new RecordFragment();
        fragment.setArguments(args);
        fragment.device = device;
        return fragment;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_device_record, container, false);
        initView(view);
        return view;
    }


    @Override
    public void onLazyInitView(@Nullable Bundle savedInstanceState) {
        super.onLazyInitView(savedInstanceState);
        mRecy.setLayoutManager(new LinearLayoutManager(_mActivity));
        mAdapter = new RecordAdapter(_mActivity);
        mAdapter.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(int position, View view, RecyclerView.ViewHolder vh) {

            }
        });

    }



    private void initView(View view) {
        Toolbar toolbar = view.findViewById(R.id.toolbar);
        toolbar.setTitle("开门记录");
        initToolbarNav(toolbar);
        mRecy = view.findViewById(R.id.fragment_device_record_rv);
    }

}
